package com.yuch.config.single;

/**
 * @projectName: springboot_31_ActiveMQ
 * @author: yuch
 * @description: TODO
 * @date: 2024/8/5 15:11
 */

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 单例模式缓存
 */
public class SingleMap {

    private void singleMap() {

    }

    private static ConcurrentHashMap<String,Object> singleMap;

    public static Map getInstance() {
        if (singleMap == null) {
            synchronized (SingleMap.class) {
                if (singleMap == null) {
                    singleMap = new ConcurrentHashMap<String,Object>();
                }
            }
        }
        return singleMap;
    }

}
